import * as React from 'react';
import * as ReactDOM from 'react-dom';

import { Provider } from 'react-redux';
import createHistory from 'history/createBrowserHistory';
import { Route, Redirect, Switch } from 'react-router-dom';

import { ConnectedRouter, push } from 'react-router-redux';
import globalStore from './store/globalStore';
// import { routes } from './routes';


import NotFound from './components/pages/NotFound';
import Login from './components/pages/Login';
import {App} from './containers';

const store = globalStore();
const history = createHistory();
const loggedIn = localStorage.getItem('loggedIn');

ReactDOM.render(
  <Provider store={store}>
    <ConnectedRouter history={history}>
      <Switch>
        <Route exact path="/" render={() => <Redirect to="/app/dashboard/index" push />} />        
        <Route path="/app" component={App} />
        {/* <Route path="/404" component={NotFound} />
        <Route path="/login" component={Login} />
        <Route component={NotFound} /> */}
      </Switch>
    </ConnectedRouter>
  </Provider>,
  document.getElementById('app')
)